Skip to content

honor zmin/zmid/zmax in annotated_heatmap font colors - #2921

Merged
nicolaskruchten merged 3 commits into
masterfrom
annotated_heatmap_colors
Nov 26, 2020
Merged

honor zmin/zmid/zmax in annotated_heatmap font colors#2921
nicolaskruchten merged 3 commits into
masterfrom
annotated_heatmap_colors

Conversation

@nicolaskruchten

Copy link
Copy Markdown
Contributor

Alternative to #2892 to close #2187, cc @bensdm.

This is a more targeted fix for the zmin/zmax problem specifically, and doesn't address the difficulty of light colors in the middle range of a diverging colorscale.

@nicolaskruchten
nicolaskruchten merged commit b409770 into master Nov 26, 2020

if np and isinstance(self.z, np.ndarray):
self.zmin = np.amin(self.z)
self.zmax = np.amax(self.z)

@bensdm bensdm Nov 27, 2020

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use np.nanmin and np.nanmax

for n, row in enumerate(self.z):
for m, val in enumerate(row):
font_color = min_text_color if val < z_mid else max_text_color
font_color = min_text_color if val < self.zmid else max_text_color

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about diverging colorscale?

@archmoj
archmoj deleted the annotated_heatmap_colors branch November 23, 2021 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Annotated heatmaps: font colour blends with the colour of the square when using zmin and zmax

2 participants